/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.klikmee.sms.core.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author makcro
 */
@Entity
@Table(name = "client")
@NamedQueries({ 
    @NamedQuery(name = "Client.findAll", query = "SELECT c FROM Client c"),
    @NamedQuery(name = "Client.findById", query = "SELECT c FROM Client c WHERE c.id = :id"),
    @NamedQuery(name = "Client.findByName", query = "SELECT c FROM Client c WHERE c.name = :name"),
    @NamedQuery(name = "Client.findByBlocked", query = "SELECT c FROM Client c WHERE c.blocked = :blocked"),
    @NamedQuery(name = "Client.findByCredit", query = "SELECT c FROM Client c WHERE c.credit = :credit"),
    @NamedQuery(name = "Client.findByPostpaid", query = "SELECT c FROM Client c WHERE c.postpaid = :postpaid"),
    @NamedQuery(name = "Client.findByUsername", query = "SELECT c FROM Client c WHERE c.username = :username"),
    @NamedQuery(name = "Client.findByPassword", query = "SELECT c FROM Client c WHERE c.password = :password"),
    @NamedQuery(name = "Client.findByUsernameAndPassword", query = "SELECT c FROM Client c WHERE c.username = :username and c.password = :password")})
public class Client implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "Id", nullable = false)
    private Long id;
    @Column(name = "Name", length = 100)
    private String name;
    @Column(name = "Blocked")
    private Boolean blocked;
    @Column(name = "Credit", precision = 22)
    private Double credit;
    @Column(name = "Postpaid")
    private Boolean postpaid;
    @Column(name = "Username", length = 100)
    private String username;
    @Column(name = "Password", length = 100)
    private String password;
    @OneToMany(mappedBy = "client")
    private List<Service> serviceList;

    public Client() {
    }

    public Client( Long id ) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId( Long id ) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName( String name ) {
        this.name = name;
    }

    public Boolean getBlocked() {
        return blocked;
    }

    public void setBlocked( Boolean blocked ) {
        this.blocked = blocked;
    }

    public Double getCredit() {
        return credit;
    }

    public void setCredit( Double credit ) {
        this.credit = credit;
    }

    public Boolean getPostpaid() {
        return postpaid;
    }

    public void setPostpaid( Boolean postpaid ) {
        this.postpaid = postpaid;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername( String username ) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword( String password ) {
        this.password = password;
    }

    public List<Service> getServiceList() {
        return serviceList;
    }

    public void setServiceList( List<Service> serviceList ) {
        this.serviceList = serviceList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals( Object object ) {
        if ( !(object instanceof Client) ) {
            return false;
        }
        Client other = (Client) object;
        if ( (this.id == null && other.id != null) || (this.id != null && !this.id.equals( other.id )) ) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.klikmee.sms.core.entities.Client[id=" + id + "]";
    }

}
